/// @tags: DP
#include <algorithm>
#include <cstdio>
#include <iostream>
#define rint register int

using std::cin;
using std::cout;

namespace BlueQuantum {

constexpr int maxn = 1e2 + 3, maxm = maxn * 3;

int n, dcnt;
int disc[maxm], f[maxn][maxm], g[maxm];

struct Segment {
  int p, l, r;
} a[maxn];

inline bool cmp(const Segment &x, const Segment &y) { return x.p < y.p; }

inline void update(int &a, int b) { (a < b) && (a = b); }

inline int main() {
  cin >> n;
  for (int i = 1, len; i <= n; ++i) {
    cin >> a[i].p >> len;
    a[i].l = a[i].p - len;
    a[i].r = a[i].p + len;
    disc[++dcnt] = a[i].p;
    disc[++dcnt] = a[i].l;
    disc[++dcnt] = a[i].r;
  }
  std::sort(a + 1, a + 1 + n, cmp);
  std::sort(disc + 1, disc + 1 + dcnt);
  dcnt = std::unique(disc + 1, disc + 1 + dcnt) - disc - 1;
  for (int i = 1; i <= n; ++i) {
    a[i].l = std::lower_bound(disc + 1, disc + 1 + dcnt, a[i].l) - disc;
    a[i].p = std::lower_bound(disc + 1, disc + 1 + dcnt, a[i].p) - disc;
    a[i].r = std::lower_bound(disc + 1, disc + 1 + dcnt, a[i].r) - disc;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= dcnt; ++j) g[j] = 0;
    for (int j = 1; j <= dcnt; ++j) f[i][j] = f[i - 1][j];
    int p = a[i].p, l = a[i].l, r = a[i].r;
    int R = p;
    g[R] = f[i - 1][l] + disc[R] - disc[l];
    for (int j = i - 1; j >= 1; --j) {
      update(R, a[j].r);
      update(g[R], f[j - 1][l] + disc[R] - disc[l]);
    }
    for (int j = dcnt; j >= l; --j) {
      update(f[i][j], g[j]);
      update(g[j - 1], g[j] - (disc[j] - disc[j - 1]));
    }
    for (int j = p; j <= r; ++j) update(f[i][j], f[i - 1][p] + disc[j] - disc[p]);
    for (int j = 1; j <= dcnt; ++j) update(f[i][j], f[i][j - 1]);
  }
  cout << f[n][dcnt];
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("CF559E Gerald and Path.in", "r", stdin);
  freopen("CF559E Gerald and Path.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
